import React, { PureComponent } from 'react';
import "../../../styles/Index/Home/Swiper.scss"
import { banner } from "../../../api/index"
import { Swiper } from 'antd-mobile'

class MySwiper extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            pic: []
        }
    }
    async componentDidMount() {
        var res = await banner();
        // console.log(res.data);
        this.setState({ pic: res.data.data })
    }
    render() {
        return (
            <div className='swiper'>
                <Swiper autoplay loop className='swiperss'>
                    {
                        this.state.pic.map((item, index) => {
                            return (
                                <Swiper.Item key={index} className='item'>
                                    <img src={item.img} alt="" />
                                </Swiper.Item>
                            )
                        })
                    }
                </Swiper>
            </div>
        );
    }
}

export default MySwiper;



